package com.zjitc.service;

import com.github.pagehelper.PageInfo;
import com.zjitc.common.ServerResponse;
import com.zjitc.model.Product;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpSession;

/**
 * Create by IntelliJ IDEA
 *
 * @author: MaoYongQi
 * @date-Time: 2018/4/2 10:24
 * @description:
 */
public interface ProductService {

    /**
     * 商品列表
     *
     * @param pageNum
     * @param pageSize
     * @param orderBy
     * @return
     */
    ServerResponse<PageInfo<Product>> findByList(Integer pageNum, Integer pageSize, String orderBy);

    /**
     * 商品详情
     *
     * @param productId
     * @return
     */
    ServerResponse<Product> findDetail(Integer productId);

    /**
     * 产品list
     *
     * @param pageNum
     * @param pageSize
     * @param session
     * @return
     */
    ServerResponse<Product> findAllByList(Integer pageNum, Integer pageSize, HttpSession session);

    /**
     * 产品搜索
     *
     * @param productName
     * @param productId
     * @param pageNum
     * @param pageSize
     * @param session
     * @return
     */
    ServerResponse<Product> serach(String productName, String productId, Integer pageNum, Integer pageSize,
                                   HttpSession session);

    /**
     * 产品上下架
     *
     * @param productId
     * @param status
     * @return
     */
    ServerResponse<Product> setStatus(@Param("productId") Integer productId, @Param("status") Integer status);

    /**
     * 新增或更新
     * @param product
     * @return
     */
    ServerResponse<Product> update(Product product);
}
